package maiyatian.videolive.live;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import org.xutils.view.annotation.ContentView;
import org.xutils.x;

import maiyatian.videolive.IActivity;
import maiyatian.videolive.R;
import maiyatian.videolive.live.fragment.OverLiveFragment;
import maiyatian.videolive.live.fragment.OverLiveLiverFragment;
import maiyatian.videolive.live.fragment.StartLiveFragment;

/**
 * 作者：王中阳 on 2016/5/15 14:04
 * 邮箱：wangzhongyang@maiyatian.com
 * QQ(微信):425772719
 * 公司：北京麦芽田网络科技有限公司
 */
@ContentView(R.layout.activity_livebox)
public class LiveBoxActivity extends IActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        mPageTo = LiveBoxActivity.this.getIntent().getStringExtra(IActivity.PAGETO);
        switchFragment(mPageTo);
    }

    private void switchFragment(String mPageTo) {
        Fragment fragment = null;
        switch (mPageTo) {
            case StartLiveFragment.TAG:
                fragment = StartLiveFragment.newInstance();
                break;
            case OverLiveFragment.TAG:
                fragment = OverLiveFragment.newInstance();
                break;
            case OverLiveLiverFragment.TAG:
                fragment = OverLiveLiverFragment.newInstance();
                break;
        }
        if (fragment != null) {
            getSupportFragmentManager().beginTransaction().replace(R.id.frameLiveBox, fragment).commit();
        }
    }


}
